#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
	double money = 0;
	int m = 0;
	int d = 0;
	int num = 0;
	scanf("%lf %d %d %d", &money, &m, &d, &num);
	if (m == 11) {
		money = money * 0.7;
		if (num == 1) {
			money = money - 50;
		}
	}
	else {
		money = money * 0.8;
		if (num == 1) {
			money = money - 50;
		}
	}
	if (money > 0) {
		printf("%.2f\n", money);
	}
	else {
		printf("0.00\n");
	}
	return 0;
}
